package com.zhoug.zmui3demo.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.zhoug.common3.utils.ToastUtils;
import com.zhoug.zmui3.ints.OnSelectedListener;
import com.zhoug.zmui3.progress.ZMUILineNodeProgressLayout;
import com.zhoug.zmui3demo.R;

import androidx.appcompat.app.AppCompatActivity;

public class ProgressActivity extends AppCompatActivity {

    private TextView mBtn1;
    private TextView mBtn2;
    private TextView mBtn3;
    private ZMUILineNodeProgressLayout mLineProgressLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_progress);
        findViews();

        mLineProgressLayout.setOnSelectedListener(new OnSelectedListener() {
            @Override
            public void onSelected(int selected) {
                ToastUtils.toastShortCenter("选中:" + selected);
            }
        });
    }

    private void findViews() {
        mBtn1 = findViewById(R.id.btn1);
        mBtn2 = findViewById(R.id.btn2);
        mBtn3 = findViewById(R.id.btn3);
        mLineProgressLayout = findViewById(R.id.lineProgressLayout);
    }

    public void nextStep(View view) {
        int i = mLineProgressLayout.getSelection() + 1;
        if (i < mLineProgressLayout.getNodeSize()) {
            mLineProgressLayout.setSelection(i);
        }
    }
}